package cn.john.hrm.constant;

public enum GradeLevel {
    bronze(1l,"青铜"),silver(2l,"白银"),gold(3l,"黄金"),platinum(4l,"铂金");
    private Long id;
    private String gradeName;

    GradeLevel(Long id, String gradeName) {
        this.id = id;
        this.gradeName = gradeName;
    }

    public static GradeLevel checkLevelById(Long id) {
        // 获取当前所有的枚举值
        GradeLevel[] levels = GradeLevel.values();
        for (GradeLevel level:levels){
            // 和外界传过来的id比对
            if (level.getId() == id){
                return level;
            }
        }
        return null;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getGradeName() {
        return gradeName;
    }

    public void setGradeName(String gradeName) {
        this.gradeName = gradeName;
    }
}
